package service.impl;

import dao.ITopicDao;
import entity.Topic;
import org.apache.ibatis.session.SqlSession;
import org.json.JSONArray;
import service.ITopicService;
import utils.SqlSessionFactoryUtils;

import java.util.List;

public class TopicService implements ITopicService {
    SqlSession session= SqlSessionFactoryUtils.getSqlSession();
    ITopicDao iTopicDao=session.getMapper(ITopicDao.class);
    @Override
    public JSONArray allTopic() {
        List<Topic> list=iTopicDao.allTopic();
        JSONArray jsonArray=new JSONArray();
        jsonArray.put(list);
        return jsonArray;
    }

    @Override
    public List<Topic> allTopic2() {
        List<Topic> list=iTopicDao.allTopic();
        return list;
    }
}
